using System;
using System.Linq;
using System.Reflection;
using Servlets.Attributes;
using System.Collections.Generic;

namespace Servlets.Utils {
	public static class ReflectionUtils {
		public static bool IsNumberType(this Type type) {
			return type == typeof(int) || type == typeof(double) || type == typeof(float) || type == typeof(long) || type == typeof(byte) || type == typeof(decimal) || type == typeof(short);
		}
		
		public static object CreateInstance(this Type type, params object[] parameters) {
			Type[] types = parameters.Select(o => o.GetType()).ToArray();
			return type.GetConstructor(types).Invoke(parameters);
		}
	}
}
